<template>
	<view>
		<view class="editTel-setting">
			<view class="editTel-item">
				<image src="../../static/images/icon_setting_anquan@3x.png" class="editTel-item-icon"></image>
				<view class="editTel-item-right">
					<label class="editTel-item-text">{{tel}}</label>
				</view>
			</view>
			<view class="editTel-item">
				<image src="../../static/images/icon_setting_shouquan@3x.png" class="editTel-item-icon"></image>
				<view class="editTel-item-right">
					<uni-easyinput class="editTel-item-input" type="text" v-model="code" placeholder="请输入验证码"
						:inputBorder="false" :placeholderStyle="placeholderStyle" maxlength="6" />
					<label class="code-btn" @click="onGetCode">{{codeBtnText}}</label>
				</view>
			</view>
			<view class="editTel-item">
				<image src="../../static/images/icon_setting_yijian@3x.png" class="editTel-item-icon"></image>
				<view class="editTel-item-right">
					<uni-easyinput class="editTel-item-input" type="text" v-model="newTel" placeholder="请输入密码"
						:inputBorder="false" :placeholderStyle="placeholderStyle" maxlength="11" />
				</view>
			</view>
			<view class="editTel-item">
				<image src="../../static/images/icon_setting_shouquan@3x.png" class="editTel-item-icon"></image>
				<view class="editTel-item-right">
					<uni-easyinput class="editTel-item-input" type="text" v-model="newTel" placeholder="请再次输入密码"
						:inputBorder="false" :placeholderStyle="placeholderStyle" maxlength="11" />
				</view>
			</view>
		</view>
		<button type="default" :disabled="disabled" class="submit-btn" @click="onSubmitClick">提交</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				disabled: false,
				placeholderStyle: "font-size:30rpx;color:#acacac;",
				tel: "186****1688",
				newTel: "",
				code: "",
				codeBtnText: "获取验证码",
				timeOut: 60,
			}
		},
		methods: {
			onGetCode() {
				if (this.timeOut != 60) {
					return;
				}
				var _this = this;
				var timer = setInterval(function() {
					_this.codeBtnText = "倒计时(" + _this.timeOut + ")";
					_this.timeOut--;
					if (_this.timeOut == 0) {
						timer.close();
						_this.codeBtnText = "重新获取"
						this.codeDisabled = false;
					}
				}, 1000)
			},
			onSubmitClick() {
				uni.navigateBack()
			}
		}
	}
</script>

<style>
	page {
		background: #F4F4F4;
	}

	.editTel-setting {
		margin: 26rpx 32rpx;
		border-radius: 16rpx;
		background-color: #FFFFFF;
	}

	.editTel-item {
		padding: 0 30rpx;
		height: 96rpx;
		display: flex;
		align-items: center;
	}

	.editTel-item:active {
		opacity: 0.8;
	}

	.editTel-item-icon {
		width: 32rpx;
		height: 32rpx;
		margin-right: 19rpx;
	}

	.editTel-item-right {
		flex: 1;
		display: flex;
		align-items: center;
		height: 100%;
		border-bottom: 1px solid #E5E5E5;
	}

	.editTel-item:last-child .editTel-item-right {
		border: 0;
	}
	.editTel-item-input{
		flex: 1;
	}
	.code-btn {
		font-size: 22rpx;
		color: #FFFFFF;
		background-color: #ACACAC;
		padding: 6rpx 10rpx;
		border-radius: 4rpx;
	}

	.submit-btn {
		margin-top: 40rpx;
	}
</style>
